﻿namespace 依赖注入案例练习;

public class IniFileConfig:IConfig
{
    public string FilePath { get; set; }

    public string GetValue(string name)
    {
        var value = File.ReadAllLines(FilePath)
            .Select(line => line.Split('='))
            .Select(kv => new { name = kv[0], value = kv[1] })
            .SingleOrDefault(v => v.name == name);
        if (value!=null)
        {
            return value.value;
        }

        return null;
    }
}